<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/reset.css">
    <style>
        /* #box::-webkit-scrollbar{
            display: none;
        } */
        #box{
            width: 200px;
            height: 200px;
            border: 1px solid transparent;
            background-color: #6ff;
            margin: 50px;
            position: absolute;
            left: 50px;
            top: 50px;
        }
       
        .active{
            background-color: pink !important;
            border-color: red !important;
        }
    </style>
</head>
<body>
    <div id="box" class="one two three"></div>
</body>
<script>
    var box = document.getElementById("box");
    console.dir(box);
    
    // offsetLeft  offsetTop   获取元素相对于参照物父元素的偏移 (margin + 定位)
    // offsetParent        参照物父元素(参照物父元素可以变的  => 可以获取匹配的元素相对于某个父代元素的偏移)

    // 如何确定参照物父元素?
    // 自目标元素的父元素开始 


    
    console.log(box.offsetParent,box.offsetLeft,box.offsetTop);



</script>
</html>